﻿using CommunityToolkit.Mvvm.ComponentModel;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;


namespace Company.Database.Entities
{
    public abstract class EntityBase : ObservableObject
    {
        /// <summary>
        /// 主键id
        /// </summary>
        private int id;
        [Key]
        [DatabaseGenerated(DatabaseGeneratedOption.Identity)]//自动递增
        public int Id
        {
            get => id;
            set => SetProperty(ref id, value);
        }
        /// <summary>
        /// 插入时间
        /// </summary>
        private DateTime insertDate = DateTime.Now;
        [DatabaseGenerated(DatabaseGeneratedOption.Identity)]
        public DateTime InsertDate
        {
            get => insertDate;
            set => SetProperty(ref insertDate, value);
        }
    }
}
